package com.itheima.demo;

import java.io.IOException;
import java.net.*;

/**
 * @author Zhang_Han
 * @version 1.0
 * @date 2020/7/16 11:35
 */
public class Demo_UDP_01 {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket();
        byte[] bytes = "1234567".getBytes();
        InetAddress address = InetAddress.getByName("127.0.0.1");
        int port = 10000;
        DatagramPacket dp = new DatagramPacket(bytes, bytes.length, address, port);
        //send
        ds.send(dp);
        ds.close();
    }
}
